package com.ruoyi.demo.util;

import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.List;

public abstract class IOUtil {
    //库地址
      String address;
    //项目名
      String project;
    //文件根地址
      String root;
    //用户文件地址
      String user;

      String meet;

    //用户头像地址
      String user_avatar;

      String user_photos;

      String user_faceid;

      String meet_video;

      String meet_audio;

      String meet_photos;

    public abstract void init();

    //上传写入，返回写入文件地址
    abstract String put(MultipartFile file, String uploadPath, String fileName);

    //上传写入，返回写入文件地址
    abstract String put(File file, String uploadPath, String fileName);

    public abstract MultipartFile getLocalMultipartFile(String filePath);

    //读取文件，获取其字节码
    abstract byte[] getFileBytes(String filePath);

    //读取文件，MultipartFile形式返回
    public abstract MultipartFile getMultipartFile(String filePath);

    public abstract byte[] getLocalFileBytes(String localFilePath) throws IOException;

    //读取文件，File形式返回
      abstract File getFile(String filePath);

    //读取输入流，读取文件，方便后续扩展F
      abstract InputStream getInputStream(String filePath);

    //输出流，写入文件，输出到库，方便后续扩展
      abstract OutputStream getOutputStream(String filePath);

    //删除文件，返回是否成功
      abstract boolean deleteFile(String filePath);

    //判断文件是否存在
      abstract boolean isExist(String filePath);

    // 获取文件列表
      abstract List<String> getFileList(String path);

    //衍生函数
    //上传图片
      abstract String uploadImage(MultipartFile file, String filePath, String fileName);

    //获取图片
      abstract MultipartFile getImage(String filePath);

    // 上传纪要到 MinIO
    public abstract String uploadSummaryToMinIO(String summary, String meet_id, String title, String basePath);

    //
    //上传
    //上传议程视频
    public abstract String uploadAgendaVideo(MultipartFile multipartFile, String meet_id);
    //上传议程音频
    public abstract String uploadAgendaAudio(MultipartFile multipartFile, String meet_id);
    //获取
    //议程视频
    public abstract MultipartFile getAgendaVideo(String fileName, String meet_id);
    //议程音频
    public abstract MultipartFile getAgendaAudio(String fileName, String meet_id);


    //    上传视频
      abstract String uploadVideo(MultipartFile multipartFile, String path, String fileName);

    //    上传视频
      abstract String uploadVideo(File file, String path, String fileName);

    //  上传视频流
      abstract OutputStream uploadVideoStream(String filePath);

    //    获取视频
    public abstract MultipartFile getVideo(String filePath);

    //    获取视频流
    public abstract InputStream getVideoStream(String filePath);

    //    上传音频
    public abstract String uploadAudio(MultipartFile file, String path, String fileName);

    //  上传音频流
      abstract OutputStream uploadAudioStream(String filePath);

    //    获取音频
    public abstract MultipartFile getAudio(String filePath);

    //    获取音频流
    public abstract InputStream getAudioStream(String filePath);

    //上传用户头像
    public abstract String uploadUserAvatar(MultipartFile file, String user_id);

    //获取头像
    public abstract MultipartFile getUserAvatar(String fileName, String user_id);

    //删除头像
    public abstract boolean deleteUserAvatar(String fileName, String user_id);

    //上传用户照片
    public abstract String uploadUserPhoto(MultipartFile multipartFile, String user_id);

    //获取用户照片文件
    public abstract MultipartFile getUserPhoto(String fileName, String user_id);

    //获取用户照片列表
    public abstract List<String> getUserPhotoList(String user_id);

    //删除用户照片
    public abstract boolean deleteUserPhoto(String fileName, String user_id);

    //上传用户人脸照片（纯上传，未序列化，无法用于识别）
    public abstract String uploadUserFaceID(MultipartFile fileName, String user_id);

    //获取用户人脸识别照片
    public abstract MultipartFile getUserFace(String fileName, String user_id);

    //获取用户人脸识别照片文件名
    public abstract List<String> getUserFaceList(String user_id);

    //删除用户人脸识别照片
    public abstract boolean deleteUserFace(String fileName, String user_id);

    //上传会议照片
    public abstract String uploadMeetPhoto(MultipartFile multipartFile, String meet_id);

    // 获取会议照片
    public abstract MultipartFile getMeetPhoto(String fileName, String meet_id);

    //获取会议照片文件名列表
    public abstract List<String> getMeetPhotoList(String meet_id);

    //删除会议照片
    public abstract boolean deleteMeetPhoto(String fileName, String meet_id);


    //上传会议视频
    public abstract String uploadMeetVideo(MultipartFile multipartFile, String meet_id);

    //获取会议视频，整个文件
    public abstract MultipartFile getMeetVideo(String fileName, String meet_id);

    //获取会议视频文件名
    public abstract List<String> getMeetVideoList(String meet_id);

    //获取会议音频文件名
    public abstract List<String> getMeetAudioList(String meet_id);

    //删除会议视频
    public abstract boolean deleteMeetVideo(String fileName, String meet_id);

    //获取会议视频流
    public abstract InputStream getMeetVideoStream(String fileName, String meet_id);

    //上传会议音频
    public abstract String uploadMeetAudio(MultipartFile multipartFile, String meet_id);

    //获取会议音频
    public abstract MultipartFile getMeetAudio(String fileName, String meet_id);

    //删除会议音频
    public abstract boolean deleteMeetAudio(String fileName, String meet_id);

    //获取音频文件流
    public abstract InputStream getMeetAudioStream(String fileName, String meet_id);
    //下载文件
    public abstract void downloadFile(String remotePath, String localFilePath);
}
